
import React from 'react';
import {
    StyleSheet,
    View,
    Text,
    FlatList,
} from 'react-native';
import {setSpText,setHW} from './ScreenUtil'
export default class TeacherInfo extends React.Component {
    constructor(props) {
        super(props);
    }
    render() {
        return (
            <FlatList
                data={this.props.dataList} 
                showsVerticalScrollIndicator={true}
                renderItem={({item}) => this.renderItem(item)}
                keyExtractor={(index) => index}
            />
        );
    }
    renderItem(item){
        return(
            <View style={styles.infor}>
                <View style={styles.grade}>
                    <Text style={styles.gradeText}>授课学段</Text>
                    <Text style={styles.gradeText}>{item.TEACHGRADE}</Text>
                </View>
                <View style={styles.grade}>
                    <Text style={styles.gradeText}>授课学科</Text>
                    <Text style={styles.gradeText}>{item.TEACHSUBJECT}</Text>
                </View>
                <View>
                    <Text style={styles.experienceTitle}>教育工作经历：</Text>
                    {this.experienceFun(item.LISTUSEREXPERIENCE)}
                </View>
            </View>
        )
    }
    // 工作经历
    experienceFun(arr){
        if(arr&&arr.length){
            return arr.map((item,i)=>{
                return(
                    <Text key={i} style={styles.experienceText}>{item.CONTENT}</Text>
                )
            })
        }else{
            return(
                <Text style={styles.experienceText}>暂无</Text>
            )
        }
    }
}
const styles  = StyleSheet.create({
    infor:{
        backgroundColor:'#fff',
        padding:setHW(20),
        paddingTop:setHW(4),
    },
    grade:{
       flexDirection:'row',
       justifyContent:'flex-start',
       paddingTop:setHW(24),
    },
    gradeText:{
        color:'#333',
        paddingRight:setHW(24),
        fontSize:setSpText(28),
        marginBottom:setHW(10),
    },
    experienceTitle:{
        color:'#333',
        paddingTop:setHW(20),
        paddingBottom:setHW(4),
        fontSize:setSpText(28),
    },
    experienceText:{
        color:'#666666',
        fontSize:setSpText(26),
        lineHeight:setHW(40),
    }
})